package com.unipay.spring.pojo;

/**
 * @BelongsProject: SSM
 * @Author: cmy
 * @CreateTime: 2023-01-15  21:23
 * @Description: TODO
 */

public class User {
    private Integer id;
    private String username;
    private String password;
    private Integer age;

    {
        System.out.println("代码块：IOC容器通过 工厂+反射 创建对象。.classForName()获取类名，无参构造，newInstance()方法...");
    }
    public User() {
        System.out.println("实例化：无参构造。。。");
    }

    public User(Integer id, String username, String password, Integer age) {
        this.id = id;
        this.username = username;
        this.password = password;
        this.age = age;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        System.out.println("反射：get方法获取属性。。。");
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                ", age=" + age +
                '}';
    }

    public void init(){
        System.out.println("初始化init：通过 标签中init-method方法 指定。。。");
    }
    public void destory(){
        System.out.println("销毁容器创建的bean对象，通过 标签中destory-method 方法指定。。。");
    }
}
